package com.example.jvm.chapter02;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JavaVMStackSOF {
    private static final Logger log = LoggerFactory.getLogger(JavaVMStackSOF.class);
    private int stackLength = 1;

    public void stackLeak() {
        stackLength++;
        stackLeak();
    }

    public static void main(String[] args) {
        JavaVMStackSOF oom = new JavaVMStackSOF();
        try {
            oom.stackLeak();
        } catch (Throwable e) {
            log.error("length:{}", oom.stackLength);
            throw e;
        }
    }
}
